package com.cloud.form.api.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.cloud.form.api.entity.FormAssemblyInst;
import com.cloud.form.common.utils.BaseMapperHelper;

public interface FormAssemblyInstMapper extends BaseMapperHelper<FormAssemblyInst> {

	@Select("select id, form_id, assembly_name from form_assembly_inst t where t.auth_flag = 1 and exists (select * from form_def d where t.form_id = d.form_id and d.proc_def_id = #{procDefId} ) order by display_order")
	@Results({ @Result(property = "formId", column = "form_id", javaType = Long.class),
			@Result(property = "assemblyId", column = "assembly_id", javaType = Long.class),
			@Result(property = "assemblyName", column = "assembly_name", javaType = String.class) })
	List<FormAssemblyInst> listFormFieldsByProc(@Param("procDefId") long procDefId);
}